#include <iostream>

using namespace std;


const int N = 100 + 10;
int m, n;

int e[N], ne[N];
int idx;

int main()
{
	cin >> n >> m;
	// 初始化
	for (int i = 1; i < n; i++) ne[i] = i + 1;
	ne[n] = 1; 

	// 开始删除节点
	int k = n;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j < m; j++)  k = ne[k];

		cout << ne[k] << " ";
		ne[k] = ne[ne[k]];
	}
	return 0;
}
